﻿using MCUPackage;
using Newtonsoft.Json;
using SxPackages.STC32G.Properties;
using System;
using System.Text;

namespace SxPackages.STC32G
{
	public class STC32GPackages : MCUPackages
	{
		/// <summary>
		/// 芯片属性
		/// </summary>
		private static MCUAttribute[] MCUs = null;
		/// <summary>
		/// 包名
		/// </summary>
		public override String Name => "STC32G";

		public STC32GPackages()
		{
			if (MCUs == null)
			{
				MCUs = new MCUAttribute[1];
				MCUs[0] = JsonConvert.DeserializeObject<MCUAttribute>(Encoding.UTF8.GetString(Resources.STC32GQFP64));
			}
		}

		/// <summary>
		/// 获取系列芯片集合
		/// </summary>
		/// <returns></returns>
		public override MCUAttribute[] GetPackages()
		{
			return MCUs;
		}

		/// <summary>
		/// 创建指定芯片配置信息
		/// </summary>
		/// <param name="aMCU"></param>
		/// <param name="aTemplateRoot"></param>
		/// <returns></returns>
		public override MCUOptions CreateOption(MCUAttribute aMCU, System.String aTemplateRoot)
		{
			if (aMCU.Name.Equals(STC32GQFP64.MODEL, StringComparison.CurrentCultureIgnoreCase))
			{
				return new STC32GQFP64(aMCU, aTemplateRoot);
			}

			return null;
		}
	}
}
